/*
 * @Descripttion: object原生方法
 * @version: 1.0.0
 * @Author: 某人
 * @Date: 2021-06-28 17:07:42
 */
Object.assign2 = function(target, ...source) {
  if (target == null) {
    throw new TypeError('Cannot convert undefined or null to object')
  }
  let ret = Object(target)
  source.forEach(obj => {
    if (obj != null) {
      for (let key in obj) {
        if (obj.hasOwnProperty(key)) {
          ret[key] = obj[key]
        }
      }
    }
  })
  return ret
}

Object.create2 = function (proto, propertyObject = undefined) {
  if (typeof proto !== 'object' && typeof proto !== 'function') {
    throw new TypeError('object prototype may only be an object or null')
  }
  if (propertyObject == null) {
    new TypeError('Cannot convert undefined or null to object')
  }
  function F () {}
  F.prototype = proto
  const obj = new F()
  if (propertyObject != undefined) {
    Object.defineProperties(obj, propertyObject)
  }
  if (proto === null) {
    obj.__proto__ = null
  }
  return obj
}